{%extends 'base01.html'%}

{%block refresh%}<meta http-equiv="refresh" content="120">{%endblock%}
{%block title%}<title>个人主页</title>{%endblock%}

{%block style%}
<style>
    .setright{
        text-align: right;
    }
</style>
{%endblock%}

{%block head1%}<h1>个人主页</h1>{%endblock%}

{%block topnav%}
    <div class="topnav">
        <a href={{url_for("article.articlelist",foid=1)}}>文章列表</a>
        <a href={{url_for('file.upload')}}>上传</a>
        <a href={{url_for('file.download')}}>下载</a>
        <a href={{url_for("root.index")}} style="float: right;">回到首页</a>
    </div>
{%endblock%}

{%block leftcolumn%}
<div class="card">
<h2>{{user.u_name}}的资料</h2>
<br>
<img src={{user.u_img}} style="align-self: center;"  alt="404" width="50%">
<dl>
    <dt><b>用户名:</b></dt> <dd><p class="setright">{{user.u_name}}</p></dd>
    {%if g.rid>=8%}
    <dt><b>UID:</b></dt><dd><p class="setright">{{user.u_id}}</p></dd>
    {%endif%}
    <dt><b>用户组:</b></dt> <dd><p class="setright">{{group.g_name}}</dd></p>
    <dt><b>当前经验:</b></dt> <dd><p class="setright">{{user.u_exp}}</dd></p>
    <dt><b>距离下一级:</b></dt> <dd><p class="setright">{{nextexp}}</dd></p>
    <dt><b>邮箱:</b></dt>   <dd><p class="setright">{{user.u_mail}}</dd></p>
    <br>
</dl> 

</div>
{%endblock%}
{%block middlecolumn%}
<div class="card">
<h2>{{user.u_name}}的文章</h2>
<br>
{%if article==[]%}
<p>暂无</p>
{%else%}
<ul>
{%for arti in article%}
<li><a target="_blank" href={{url_for("article.viewarticle",aid=arti.a_id)}}>{{arti.a_title}}</a></li>
{%endfor%}
</ul>
{%endif%}
</div>


{%endblock%}

{%block rightcolumn%}
<div class="card">
    <h2>权限</h2>
    <br>
    <ul>
    <li><a style="font-size: larger;" href="#editimg">修改头像</a>
        <hr><br>
    <iframe src={{url_for("file.uploadimg")}} frameborder="0" id="editimg"></iframe>
    <hr>
    <br>
    {%if g.rid>=7%}
    <li><a style="font-size: larger;" href="#manage">用户管理</a><hr>
    <form action="" method="post">
        <input type="hidden" name="csrf_token" value={{csrf_token()}}> <br>
    {%if (user.g_id>=12 and user.g_id<=14) or (user.g_id>=21 and user.g_id<=22) %}
        {{form.uid_select.label(style="font-size:smaller;", id="manage")}}
        {{form.uid_select (style="width:20%;height:18px")}}
    {%else%}
        <input type="hidden" name="uid_select" value={{user.u_id}} id="manage">
    {%endif%}
        {{form.ftm.label (style="font-size:smaller;")}}
        {{form.ftm}}
        <br><br>
        {{form.submit}}
    </form>
    <hr>
    {%endif%}


    </ul>
</div>
{%endblock%}}

{%block footer%}
<a href={{url_for("root.index")}}> <p style="text-align: center;">返回目录</p></a>
{%endblock%}